<template>
  <div>
    <div class="my-heard">
      <h1>
        <img src="img/Tripadvisor_header.svg" alt="" />
      </h1>
      <div class="heard-right">
        <div style="border: none" class="heard-block">
          <i class="el-icon-edit"></i>
          <span>点评</span>
        </div>
        <div style="border: none" class="heard-block">
          <i class="el-icon-star-off"></i>
          <span>旅行</span>
        </div>
        <!-- 如果用户存在 显示默认照片 -->
        <div style="width: 40px; height: 40px; padding: 0" class="heard-block">
          <img class="btn" src="/detail_f2_img/img_scenic/head.png" />
          <div class="menu">
            <!-- <div @click="goPerson()">个人页面</div> -->
            <div>账号信息</div>
            <div @click="logout">退出</div>
          </div>
        </div>
      </div>
    </div>
    <div class="center">
      <div
        style="margin-bottom: 1px solid #e5e5e5; width: 1280px; margin: 0 auto"
      >
        <el-menu
          text-color="#000"
          :default-active="activeIndex"
          class="el-menu-demo"
          mode="horizontal"
          @select="handleSelect"
        >
          <el-menu-item index="1">酒店</el-menu-item>
          <el-menu-item index="2">景点体验</el-menu-item>
          <el-menu-item index="3">美食</el-menu-item>
          <el-menu-item index="4">旅行者之选</el-menu-item>
          <el-submenu index="5">
            <template slot="title">···</template>
            <el-menu-item index="2-1">航空公司</el-menu-item>
            <el-menu-item index="2-2">下载app</el-menu-item>
          </el-submenu>
        </el-menu>
      </div>
    </div>
    <div>
      <div class="title">
        <h2>旅行</h2>
      </div>
      <div class="jihe">
        <div class="left">
          <div class="card">
            <div>
              <img src="img/bj1.jpg" alt="" />
            </div>
            <div style="padding: 18px 24px">
              <div class="name">故宫博物院</div>
              <div class="pingfen">
                <div style="margin-top: 5px">
                  <svg
                    viewBox="0 0 128 24"
                    width="68"
                    height="12"
                    aria-label
                    title
                    fill=" #00aa6c"
                  >
                    <path
                      d="M 12 0C5.388 0 0 5.388 0 12s5.388 12 12 12 12-5.38 12-12c0-6.612-5.38-12-12-12z"
                      transform="translate(0 0)"
                    ></path>
                    <path
                      d="M 12 0C5.388 0 0 5.388 0 12s5.388 12 12 12 12-5.38 12-12c0-6.612-5.38-12-12-12z"
                      transform="translate(26 0)"
                    ></path>
                    <path
                      d="M 12 0C5.388 0 0 5.388 0 12s5.388 12 12 12 12-5.38 12-12c0-6.612-5.38-12-12-12z"
                      transform="translate(52 0)"
                    ></path>
                    <path
                      d="M 12 0C5.388 0 0 5.388 0 12s5.388 12 12 12 12-5.38 12-12c0-6.612-5.38-12-12-12z"
                      transform="translate(78 0)"
                    ></path>
                    <path
                      d="M 12 0C5.388 0 0 5.388 0 12s5.388 12 12 12 12-5.38 12-12c0-6.612-5.38-12-12-12z"
                      transform="translate(104 0)"
                    ></path>
                  </svg>
                </div>
              </div>
              <div class="addr">中国北京市</div>
              <div class="addr1">特色景点</div>
            </div>
          </div>
        </div>
        <div class="right">
          <div class="area1_right">
            <div id="container"></div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapMutations } from "vuex";
import AMapLoader from "@amap/amap-jsapi-loader";
export default {
  data() {
    return {
      activeIndex: "",
    };
  },
  methods: {
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    },
    ...mapMutations(["logout"]),
    goPerson() {
      this.$router.push("/person");
    },
    logout() {
      //window.sessionStorage.clear(); //销毁token
      this.$router.push("/");
    },
    mapInit() {
      AMapLoader.load({
        key: "7bfbe3ab215345f405c23b5eed760ca8", // 申请好的Web端开发者Key，首次调用 load 时必填
        version: "2.0", // 指定要加载的 JSAPI 的版本，缺省时默认为 1.4.15
        plugins: [
          "AMap.ToolBar",
          "AMap.Scale",
          "AMap.HawkEye",
          "AMap.MapType",
          "AMap.Geolocation",
        ], // 需要使用的的插件列表，如比例尺'AMap.Scale'等
      })
        .then(AMap => {
          const map = new AMap.Map("container");
        })
        .catch(e => {
          console.log(e);
        });
    },
  },
  mounted() {
    this.mapInit();
  },
};
</script>

<style lang="scss" scoped>
.my-heard {
  box-sizing: border-box;
  width: 1280px;
  margin: 0 auto;
  height: 60px;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  img {
    width: 225px;
    height: 66px;
  }
}

.heard-right {
  color: black;
  display: flex;
  cursor: pointer;
  .heard-block {
    display: flex;
    flex-direction: row;
    font-size: 16px;
    font-weight: 700;
    vertical-align: middle;
    padding: 10px 16px;
    margin-left: 8px;
    width: 60px;
    height: 20px;
    border: 1px solid #bbb;
    border-radius: 20px;
    margin-top: 10px;
    position: relative;

    > span {
      margin-left: 5px;
    }
    > i {
      margin-top: 3px;
    }
    .btn {
      width: 40px;
      height: 40px;
      border: none;
      border-radius: 50%;
      &:hover + .menu {
        display: block;
      }
    }
  }
}
.menu {
  display: none;
  z-index: 999;
  position: absolute;
  width: 164px;
  height: 80px;
  background-color: #fff;
  border-radius: 20px;
  top: 35px;
  right: 0px;
  padding: 8px 16px;
  box-sizing: border-box;
  box-shadow: 0 2px 54px rgba(0, 0, 0, 0.1);

  > div {
    padding: 7px;
    font-size: 16px;
    font-weight: normal;
    &:hover {
      background-color: #e1e1e1e1;
    }
  }
}
.center {
  width: 100%;
  min-width: 1500px;
}
.title {
  width: 1280px;
  margin: 0 auto;

  > h2 {
    text-align: center;
  }
}
.jihe {
  width: 100%;
  min-width: 1920px;
  display: flex;
}
.left {
  width: 500px;
  padding-left: 10px;
  background-color: #f2f2f2;
}
.card {
  width: 500px;
  padding-bottom: 20px;

  margin-bottom: 15px;
  background-color: white;
  img {
    width: 100%;
    height: 260px;
  }
  .name {
    font-size: 24px;
    margin-bottom: 6px;
    color: #000a12;
  }
  .addr {
    font-size: 16px;
    color: #767676;
    margin-bottom: 4px;
  }
  .addr1 {
    font-size: 16px;
    color: #767676;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e5e5;
  }
}
.right {
  width: 100%;
  height: 100%;
}
#container {
  width: 100%;
  height: 380px;
  border: 1px solid black;
}
</style>
